package com.uniview.entity.po;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "sd_employees")
public class Employees implements Serializable {

	private static final long serialVersionUID = 2292178556561126644L;

	public int eId;

	public String EmpCode; // 工号

	public String OrgName; // 所属组织

	public String EmpName; // 姓名

	public String pinyin; // 拼音

	public String Position; // 职位

	public String LayerFlag; // 高管

	public String SortBy; // 排序号

	public String Phone; // 手机号

	public String Email; // 邮箱

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date CreatedDate; // 创建日期

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date LastUpdatedDate; // 更新日期

	public String Remark; // 备注

	public String workType; // 员工类别

	public String Resident; // 驻地

	private int count;
	
	private int emType; // 0 ：内部用户  1： 外部用户

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="employees_sequence")
	@SequenceGenerator(name="employees_sequence", sequenceName="employees_sequence", allocationSize=1, initialValue=1)
	public int geteId() {
		return eId;
	}

	public void seteId(int eId) {
		this.eId = eId;
	}

	public String getEmpCode() {
		return EmpCode;
	}

	public void setEmpCode(String empCode) {
		EmpCode = empCode;
	}

	public String getOrgName() {
		return OrgName;
	}

	public void setOrgName(String orgName) {
		OrgName = orgName;
	}

	public String getEmpName() {
		return EmpName;
	}

	public void setEmpName(String empName) {
		EmpName = empName;
	}

	public String getPosition() {
		return Position;
	}

	public void setPosition(String position) {
		Position = position;
	}

	public String getLayerFlag() {
		return LayerFlag;
	}

	public void setLayerFlag(String layerFlag) {
		LayerFlag = layerFlag;
	}

	public String getSortBy() {
		return SortBy;
	}

	public void setSortBy(String sortBy) {
		SortBy = sortBy;
	}

	public String getPhone() {
		return Phone;
	}

	public void setPhone(String phone) {
		Phone = phone;
	}

	public String getEmail() {
		return Email;
	}

	public void setEmail(String email) {
		Email = email;
	}

	public Date getCreatedDate() {
		return CreatedDate;
	}

	public void setCreatedDate(Date createdDate) {
		CreatedDate = createdDate;
	}

	public Date getLastUpdatedDate() {
		return LastUpdatedDate;
	}

	public void setLastUpdatedDate(Date lastUpdatedDate) {
		LastUpdatedDate = lastUpdatedDate;
	}

	public String getRemark() {
		return Remark;
	}

	public void setRemark(String remark) {
		Remark = remark;
	}

	public String getPinyin() {
		return pinyin;
	}

	public void setPinyin(String pinyin) {
		this.pinyin = pinyin;
	}

	public String getWorkType() {
		return workType;
	}

	public void setWorkType(String workType) {
		this.workType = workType;
	}

	public String getResident() {
		return Resident;
	}

	public void setResident(String resident) {
		Resident = resident;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getEmType() {
		return emType;
	}

	public void setEmType(int emType) {
		this.emType = emType;
	}
	
	public String feachOffice(int level){
		if(level > 0){
			if(StringUtils.isNotBlank(this.getOrgName())){
				String[] strs = this.getOrgName().split("/");
				if(strs.length >=5){
					return strs[4];
				}
			}
		}
		
		return null;
	}
}
